import { ProductCardData } from '../types/productCard';

export const transformApiDataToProductCard = (apiData: any, cardContent: string): ProductCardData => {
  const data = apiData.data || {};
  return {
    fund_code: data.fund_code || '',
    fund_name: data.fund_name || cardContent,
    fund_full_name: data.fund_full_name || '',
    found_date: data.found_date || '',
    yield: data.yield || '',
    yield_name: data.yield_name || '',
    end_date: data.end_date || '',
    annual_performance_list: data.annual_performance_list || [],
    yield_history: data.yield_history || [],
    risk_level: data.risk_level || '',
    industry: data.industry || '',
  };
};